/**
 * 
 */
package org.dragonfire.dasm.directives;

import java.util.ArrayList;

import org.dragonfire.dasm.Command;
import org.dragonfire.dasm.Listing;
import org.dragonfire.dasm.DirectiveManager.Directive;

/**
 * Generates a warning when the <code>#BREAK</code> directive is used outside
 * of a {@link org.dragonfire.dasm.preprocessor.blockDefs.SwitchBlockDef}.<br />
 * <br />
 * Format:<br />
 * <code>#BREAK</code><br />
 * <br />
 * Parameters:<br />
 * <i>None</i><br />
 * <br />
 * Errors:<br />
 * <i>None</i>
 * 
 * @author Darth Android
 * @version 2.0
 * @see org.dragonfire.dasm.directives.Case
 * @see org.dragonfire.dasm.directives.Endswitch
 * @see org.dragonfire.dasm.preprocessor.blockDefs.SwitchBlockDef
 */
public class Break extends Directive {

	/**
	 * {@inheritDoc}
	 */
	@Override
	public ArrayList<Listing> pass1(Command c) {
		// throw warning
		/*
		 * We can simply throw a warning every time because #BREAK is caught and
		 * processed as a personal directive when we're in a #SWITCH block, so
		 * this code is only encountered if we're not currently in a switch
		 * block
		 */
		warn("WARN_BREAK_NO_OPEN_BLOCK");
		return null;
	}
}
